﻿@{
    Layout = "~/_SiteLayout.cshtml";
    Business.Platform.WorkFlowForm workFlowFrom = new Business.Platform.WorkFlowForm();
}
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="../common.js"></script>
<form action="" method="post">
<div style="height:320px; overflow:auto; width:100%; margin:7px auto 0 auto;">
<table cellpadding="0" cellspacing="1" border="0" style="width:99%; margin:0 auto;" class="listtable" id="data_table">
    <thead>
    <tr>
        <th>表单名称</th>
        <th>创建时间</th>
        <th>创建人</th>
        <th>状态</th>
        <th></th>
    </tr>
    </thead>
    <tbody>
        @{
            var forms = workFlowFrom.GetAll().Where(p=>p.Status!=2).OrderBy(p=>p.Name);
            foreach(var form1 in forms)
            {  
            <tr>
                <td>@form1.Name</td>
                <td>@form1.CreateTime</td>
                <td>@form1.CreateUserName</td>
                <td>@workFlowFrom.GetStatusTitle(form1.Status)</td>
                <td>
                    <a href="javascript:void(0);" onclick="openform('@form1.ID');return false;">
                    <img src="/Images/ico/folder_classic_opened.png" alt="" style="vertical-align:middle; border:0;" />
                    <span style="vertical-align:middle;">打开</span>
                    </a>
                    <a href="javascript:void(0);" onclick="delform('@form1.ID');return false;">
                    <img src="/Images/ico/cancel.gif" alt="" style="vertical-align:middle; border:0; margin-left:5px;" />
                    <span style="vertical-align:middle;">删除</span>
                    </a>
                </td>
            </tr>   
            } 
         }
    </tbody>
</table>
</div>
</form>
<script type="text/javascript">
    function openform(id)
    {
        editor.execCommand("formopen", id);
        dialog.close();
    }
    function delform(id)
    {
        if (!confirm('您真的要删除该表单吗?'))
        {
            return;
        }
        $.ajax({
            url: 'delete.cshtml?id=' + id, cache: false, async: false, success: function (txt)
            {
                if ("1" == txt)
                {
                    window.location = window.location;
                }
                else
                {
                    alert(txt);
                }
            }
        });
    }
</script>